#ifndef COOK_H
#define COOK_H

#include <queue>
#include "stdlib.h"
#include "stdint.h"
#include "mgos.h"
#include "mgos_blynk.h"

#define v_elapsed 9 // v9

using namespace std;

typedef struct
{
  double temp;
  uint32_t time;
} mData;

class Cook
{
public:
  Cook();
  void clear();
  void add_data(mData data);
  void start();
  void stop();
  // callback_1
  static void cb_time_elapsed(void *arg)
  {
    Cook *p_class = reinterpret_cast<Cook *>(arg);
    if (p_class == NULL)
    {
      LOG(LL_INFO, ("Cook pointer is NULL\n"));
      return;
    }
    struct mg_connection *c = get_connetion();
    p_class->elapsed++;
    if (c != NULL)
    {
      blynk_virtual_write(c, v_elapsed, p_class->elapsed, 20);
    }
  }

private:
  std::queue<mData> t_t;
  bool started;
  double now;
  uint32_t elapsed;
  mgos_timer_id id_elapsed;
};

#endif